package app.kotlin_1.basemvp

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.util.Log
import app.kotlin_1.R
import kotlinx.android.synthetic.main.activity_test.*

/**
 * Created by 刘智强 on 2017/10/13.
 */
class TestActivity : AppCompatActivity(), BaseView<TestModel> {
    private var p: TestPresenter? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_test)
        p = TestPresenter()
        p?.attachView(this)
        btnOK?.setOnClickListener {
            run {
                p?.setData(p?.getDataFromModel()!!)
            }
        }
    }

    override fun showLoading() {
        Log.e("111", "showLoading")
    }

    override fun dismissLoading() {
        Log.e("111", "dismissLoading")
    }

    override fun updateUi(model: TestModel) {
        Log.e("111", "${model.name}")
    }

    override fun onDestroy() {
        super.onDestroy()
        p?.dettachView()
    }
}

